package org.shopen.puremvc.controller.notehandlers
{
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.command.SimpleCommand;
	import org.puremvc.as3.utilities.statemachine.StateMachine;
	import org.shopen.puremvc.ApplicationConstants;
	import org.shopen.puremvc.model.ProjectProxy;
	import org.shopen.puremvc.model.vo.ProjectInfo;

	public class CreateProjectCommand extends SimpleCommand
	{
		override public function execute(notification:INotification):void
		{
			try
			{
				// TODO: add some proxy here..
				
				var project : ProjectInfo = notification.getBody() as ProjectInfo;				
				var projectProxy : ProjectProxy = facade.retrieveProxy(ProjectProxy.NAME) as ProjectProxy;
				
				projectProxy.setProject(project);
				
				sendNotification(ApplicationConstants.HIDE_CREATING_WINDOW);
				sendNotification(StateMachine.ACTION, project, ApplicationConstants.ACTION_CREATE);
			}
			catch(error : Error)
			{
				sendNotification(ApplicationConstants.GENERAL_ERROR, error);
			}
		}
	}
}